// electron.vite.config.ts
import { resolve } from "path";
import { defineConfig, externalizeDepsPlugin } from "electron-vite";
import vue from "@vitejs/plugin-vue";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import viteSetupExtend from "vite-plugin-vue-setup-extend";
import IconsResolver from "unplugin-icons/resolver";
import Icons from "unplugin-icons/vite";
var electron_vite_config_default = defineConfig({
  main: {
    plugins: [externalizeDepsPlugin()]
  },
  preload: {
    plugins: [externalizeDepsPlugin()]
  },
  renderer: {
    resolve: {
      alias: {
        "@": resolve("src/renderer/src")
      }
    },
    plugins: [
      vue(),
      viteSetupExtend(),
      AutoImport({
        resolvers: [
          ElementPlusResolver(),
          // 自动导入图标组件 https://icon-sets.iconify.design/bi/  (替换url后缀即可)
          IconsResolver({
            prefix: "Icon",
            enabledCollections: ["bi"]
          })
        ]
      }),
      Components({
        resolvers: [
          ElementPlusResolver(),
          // 自动注册图标组件
          IconsResolver({
            enabledCollections: ["bi"]
          })
        ]
      }),
      Icons({
        compiler: "vue3",
        autoInstall: true
      })
    ],
    //后台服务
    server: {
      proxy: {
        //自定义后端服务
        "/p2": {
          target: "http://p2.music.126.net",
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/p2/, "")
        },
        "/p1": {
          target: "http://p1.music.126.net",
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/p1/, "")
        },
        //网易官网接口
        "/music": {
          target: "http://111.180.193.222:3000",
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/music/, "")
        },
        //网易官网接口
        "/play": {
          target: "http://m801.music.126.net",
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/play/, "")
        }
      }
    }
  }
});
export {
  electron_vite_config_default as default
};
